﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace a22_LogicalTree
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void ManChecked(object sender, RoutedEventArgs e)
        {
            ChaoGaiLabel.Foreground = Brushes.Black;
            SongJiangLabel.Foreground = Brushes.Black;
            LuJunyiLabel.Foreground = Brushes.Black;
            ChaoGaiLabel.Background = Brushes.Transparent;
            SongJiangLabel.Background = Brushes.Transparent;
            LuJunyiLabel.Background = Brushes.Transparent;

            RadioButton rb = sender as RadioButton;
            if (rb != null)
            {
                string labelName = rb.Name;
                labelName = labelName.Clone() + "Label";
                //Label lb = NicknamePanel.FindName(labelName) as Label;
                Label lb = LuJunyiLabel.FindName(labelName) as Label;
                if (lb != null)
                {
                    lb.Foreground = Brushes.Yellow;
                    lb.Background = Brushes.DarkBlue;
                }

            }
        }
    }
}
